package com.vmj.natives.sun.misc;

import com.vmj.heap.VMClass;
import com.vmj.heap.Method;
import com.vmj.instructions.base.MethodInvokeLogic;
import com.vmj.natives.NativeMethod;
import com.vmj.natives.Registry;
import com.vmj.rtda.Frame;

/**
 * Created by yangshoujun on 2017/9/17 上午11:09.
 */
public class VM {

    public static final java.lang.String jlClass = "sun/misc/VM";

    public static void init() {
        Registry.register(jlClass, "initialize", "()V", new NativeMethod() {
            public void execute(Frame frame) {
                VMClass vmClass = frame.getMethod().getClazz();
                VMClass jlClass = vmClass.getClassLoader().loadClass("java/lang/System");
                Method initSysClass = jlClass.getStaticMethod("initializeSystemClass", "()V");
                MethodInvokeLogic.invokeMethod(frame, initSysClass);
            }
        });
    }
}
